<extend name="Public/base"/>

<block name="body">
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/mymember.css">
    <div class="main-title">
        <h2><present name="data"></present>退货订单列表</h2>
    </div>
    <div class="cf">
      <p style="float:left;">
          <a href="{:U('Order/orderReturn',array('sort'=>'asc'))}" class="btn">ID正向排序</a>
          <a href="{:U('Order/orderReturn',array('sort'=>'desc'))}" class="btn">ID逆向排序</a>
      </p>
      <!-- 高级搜索 -->
      <div class="search-form fr cf">
        <div class="sleft">
          <input type="text" name="order_num" class="search-input" value="{:I('order_num')}" placeholder="请输入订单号或者会员账号">
          <a class="sch-btn" href="javascript:;" id="search" url="{:U('orderReturn')}"><i class="btn-search"></i></a>
        </div>
      </div>
    </div>

    <div class="data-table table-striped">
        <table>
            <thead>
                <tr>
                    <th class="row-selected">
                        <input class="checkbox check-all" type="checkbox">
                    </th>
                    <th>ID</th>
                    <th>订单号</th>
                    <th>会员账号</th>
                    <th>订单状态</th>
                    <th>处理人</th>
                    <th>退货原因</th>
                    <th>备注</th>
                    <th>处理时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
				<notempty name="list">
                <volist name="list" id="val">
                    <tr>
                        <td><input class="ids row-selected" type="checkbox" name="id[]" value="{$val.id}"></td>
                        <td>{$val.id}</td>
                        <td><a href="{:U('order/orderlist?order_num='.$val['order_num'])}">{$val.order_num}</a></td>
                        <td>{$val.username}</td>
                        <td>{$val.order_status}</td>
                        <td>{$val.handlename}</td>
                        <td>{$val.reason}</td>
                        <td>{$val.remark}</td>
                        <td>{$val.handletime|date="Y-m-d",###}</td>
                        <td>
                        <neq name='val.order_status' value="退货完成">
                          <a href="{:U('Order/dealwith?order_num='.$val['order_num'])}">退单处理</a>
                        </neq>
                        </td>
                    </tr>
                </volist>
				<else/>
				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table>
        <div class="page">

        </div>
    </div>
</block>

<block name="script">
  <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">

        $(function() {
            //搜索功能
            $("#search").click(function() {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
            //导航高亮
            highlight_subnav('{:U('Order/orderReturn')}');
            //点击排序
        	$('.list_sort').click(function(){
        		var url = $(this).attr('url');
        		var ids = $('.ids:checked');
        		var param = '';
        		if(ids.length > 0){
        			var str = new Array();
        			ids.each(function(){
        				str.push($(this).val());
        			});
        			param = str.join(',');
        		}

        		if(url != undefined && url != ''){
        			window.location.href = url + '/ids/' + param;
        		}
        	});
        });
    </script>
</block>
